package com.ghpt.controller;
import com.ghpt.pojo.TanBuJi;
import com.ghpt.service.TanBuJiService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/tanbuji")
public class TanBuJiController {
    private final TanBuJiService tanBuJiService;

    public TanBuJiController(TanBuJiService tanBuJiService) {
        this.tanBuJiService = tanBuJiService;
    }
    @GetMapping("/{id}")
    public TanBuJi getTanBuJiById(@PathVariable Long id) {
        System.out.println("结果是"+tanBuJiService.findTanBuJiById(id));
        return tanBuJiService.findTanBuJiById(id);
    }
    @PutMapping
    public int updateTanBuJi(@RequestBody TanBuJi tanBuJi) {
        return tanBuJiService.updateById(tanBuJi);
    }
}
